<template>
  <div>
    <p>我就想看看效果</p>
    <el-breadcrumb separator-class="el-icon-arrow-right" style="font-size: 16px;">
      <el-breadcrumb-item :to="{ path: '/' }">
        <i class="el-icon-s-promotion"></i> 用户管理
      </el-breadcrumb-item>
      <el-breadcrumb-item>用户列表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-divider></el-divider>

    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="id" label="ID" width="80" align="center"></el-table-column>
      <el-table-column prop="name" label="名称" width="230" header-align="center"
                       :show-overflow-tooltip="true"></el-table-column>
      <el-table-column prop="pwd" label="密码" header-align="center"
                       :show-overflow-tooltip="true"></el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData: []
    }
  },
  created() {
    console.log('created...');
    this.loadUserList();
  },
  methods: {
    loadUserList() {
      console.log('loadUserList...');
      let url = 'http://localhost:8888/list';
      console.log('url = ' + url);

      this.axios
          .create({'headers': {'Authorization': localStorage.getItem('jwt')}})
          .get(url).then((response) => {
        let responseBody = response.data;
        this.tableData = responseBody.data;
      });
    }
  },
  mounted() {
    console.log('mounted...');
    this.loadUserList();
  },
  activated() {
    console.log('activated...');
    this.loadUserList();
  }
}
</script>

<style scoped>
/*Authorization*/

</style>